import request from '@/utils/request'

// 查询评论列表
export function listComment(query) {
  return request({
    url: '/bbsAdmin/comment/list',
    method: 'get',
    params: query
  })
}

// 查询评论详细
export function getComment(commentid) {
  return request({
    url: '/bbsAdmin/comment/' + commentid,
    method: 'get'
  })
}

// 新增评论
export function addComment(data) {
  return request({
    url: '/bbsAdmin/comment',
    method: 'post',
    data: data
  })
}

// 修改评论
export function updateComment(data) {
  return request({
    url: '/bbsAdmin/comment',
    method: 'put',
    data: data
  })
}

//修改评论状态
export function updateCommentState(data){
    return request({
      url: '/bbsAdmin/comment/commentState',
      method: 'put',
      data: data
    })
}

// 删除评论
export function delComment(commentid) {
  return request({
    url: '/bbsAdmin/comment/' + commentid,
    method: 'delete'
  })

}

// 根据帖子内容获取其下的全部评论
export function getCommentById(contentId){
  return request({
    url: '/bbsAdmin/comment/id/' + contentId,
    method: 'get'
  })
}

// 根据帖子内容获取其下的全部评论
export function getCommentVoById(contentId){
  return request({
    url: '/bbsAdmin/comment/commentVoById/' + contentId,
    method: 'get'
  })
}

// 删除所有评论列表的redis缓存
export function deleteCommentListInRedis(query){
  return request({
    url: '/bbsAdmin/comment/deleteCommentListInRedis/',
    method: 'get',
	params: query
  })
}

// 按学校查询评论列表
export function listCommentBySchool(query) {
  return request({
    url: '/bbsAdmin/comment/listBySchool',
    method: 'get',
    params: query
  })
}

export function getHotComment(query) {
  return request({
    url: '/bbsAdmin/comment/getHotComment',
    method: 'get',
    params: query
  })
}
